<%-- 
    Document   : message
    Created on : 24.04.2009, 14:53:15
    Author     : Вадим
--%>

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Сообщение и ответы</title>
        <link rel="stylesheet" href="css/my.css" type="text/css">
        <script type="text/javascript" src="js/nicetitle.js"></script>
        <script type="text/javascript" src="js/comments.js"></script>
    </head>
    <body>
        <c:import url="header.jsp"></c:import>
        <script language="JavaScript">
        <!--
                var my_form = '\n' +
'                 <div class="comnts-form">\n' +
'                 <form method="POST" name="form_comment" id="form_comment" action="Post.perform">\n'+
'<textarea style="width:100%;" rows="10" name="message" >Ваше сообщение</textarea><br>\n'+
            '<input type="hidden" id="display_id" name="display_id" value="">\n'+
'            <div class="btn"><input type="submit" align="middle" value="Отправить"></div><br>\n'+
'            </form></div>\n';
        var last_div = '';
-->
</script>
        <center><h2>Сообщение и ответы</h2></center>
            <c:forEach var="m" begin="0" items="${requestScope.messages}">
                 <div class="post" id="${m.ID}" style="margin-left:${(m.level-1)*10}%;">
                    <div class="post_header">
                    <div id="leftcol">
                       <a href="#${m.ID}">#${m.ID}</a>&nbsp;&nbsp;
                       <a href="ViewProfile.perform?id=${m.user.ID}"><b>${m.user.login}</b></a>&nbsp;
                    ${m.time}
                    </div>
                    <div id="rightcol">
                        <a title="Ответ на #${m.parent_id}" href="#${m.parent_id}">&uarr;</a>&nbsp;
                        <!--<a href="ViewPostForm.perform?id=${m.ID}">Ответить</a>-->
                        <a href="javascript:void(0)" onclick="javascript:showComment(${m.ID},'${(m.level-1)*10}%',${requestScope.pid})">Ответить</a>
                        <c:if test="${!empty user}" >
                            <c:if test="${requestScope.user.adminRights}" >
                             &nbsp;<a title="Удалить #${m.ID}" href="DeleteMessage.perform?id=${m.ID}">X</a>
                            </c:if>
                        </c:if>
                    </div></div>
                     <br/>
                     <div class="post_text"><c:out value="${m.text}"/></div><br/>
                 </div>
                 <div class="empty"></div>
                 <div id="form_comment_${m.ID}" style="width:40%;"></div>
            </c:forEach>
    </body>
</html>
